package GUI;

/**
 *
 * @author David Ponce
 * @author Philipp Armbruster
 */

import Interaction.ServerConnection;
import Flightadministration.Flightadministration;
import java.rmi.RemoteException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyleContext;
import javax.swing.tree.*;

import java.awt.CardLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JSplitPane;
import javax.swing.JTextPane;
import javax.swing.JTree;
import javax.swing.ToolTipManager;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;



public class Main extends JFrame {

    public AirportManage am;
    public AirportCreate ac;
    public AirportEdit ae;
    public AircraftManage acm;
    public AircraftCreate acc;
    public AircraftEdit ace;

    public AircraftTypeManage actm;
    public AircraftTypCreate actc;
    public AircraftTypEdit acte;
    public AirlineManage alm;
    public AirlineCreate alc;
    public AirlineEdit ale;

    public FlightManage flm;
    public FlightCreate flc;
    public FlightManageMo flmMo;
    public FlightManageDi flmDi;
    public FlightManageMi flmMi;
    public FlightManageDo flmDo;
    public FlightManageFr flmFr;
    public FlightManageSa flmSa;
    public FlightManageSo flmSo;
    public FlightRealizationManage flrm;
    public FlightRealizationManageMo flrmMo;
    public FlightRealizationManageDi flrmDi;
    public FlightRealizationManageMi flrmMi;
    public FlightRealizationManageDo flrmDo;
    public FlightRealizationManageFr flrmFr;
    public FlightRealizationManageSa flrmSa;
    public FlightRealizationManageSo flrmSo;
    public FlightRealizationCreate flrc;
    public FlightRealizationEdit flre;

    public OverviewFlights ovf;
    public OverviewFlightsMo ovfMo;
    public OverviewFlightsDi ovfDi;
    public OverviewFlightsMi ovfMi;
    public OverviewFlightsDo ovfDo;
    public OverviewFlightsFr ovfFr;
    public OverviewFlightsSa ovfSa;
    public OverviewFlightsSo ovfSo;

    public PassengerManage pm;
    public PassengerManageAE pmAE;
    public PassengerManageFJ pmFJ;
    public PassengerManageKO pmKO;
    public PassengerManagePT pmPT;
    public PassengerManageUZ pmUZ;
    public PassengerCreate pc;
    public PassengerEdit pe;

    public SeatStructureManage stm;
    public SeatStructureCreate stc;

    public BookingCreate bc;
    public BookingManage bm;

    public ReportShowPassengerinformation rpi;
    public ReportShowSeatingPlan rsp;

    /*Das AdministrationsObjekt, welches über die getConnection methode vom RMI Server geholt wird, dem "admin" objekt zugewiesen.
    *Dadurch ist eine Kommunikation zwischen GUI und Applikationsserver mittels RMI möglich*/
    final Flightadministration admin = ServerConnection.getConnection();

    CardLayout cardLayout;
    JPanel rightp;
    JPanel leftp;

    JMenuBar menueLeiste;
    JMenu datei;
    JMenuItem editor;
    JMenuItem report;
    JMenuItem beenden;

    public Main() throws RemoteException {

        this.setTitle("Flugbuchungsmanagementsystem");
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setResizable(false);
        
        cardLayout = new CardLayout();
        leftp = new JPanel();

        // Erstellung des Editor-Trees
        final DefaultMutableTreeNode verwaltung = new DefaultMutableTreeNode(
                new ToolTip ("Editor > Verwaltung", "Editierverwaltung"));

        DefaultMutableTreeNode passengerT = new DefaultMutableTreeNode(
                new ToolTip ("Passagier", "Passagierverwaltung"));
        DefaultMutableTreeNode airportT = new DefaultMutableTreeNode(
                new ToolTip ("Flughafen", "Flughafenverwaltung"));
        DefaultMutableTreeNode seatStructureT = new DefaultMutableTreeNode(
                new ToolTip ("Sitzstruktur", "Sitzstrukturverwaltung"));
        DefaultMutableTreeNode aircraftTypT = new DefaultMutableTreeNode(
                new ToolTip ("Flugzeugtyp", "Flugzeugtypverwaltung"));
        DefaultMutableTreeNode airlineT = new DefaultMutableTreeNode(
                new ToolTip ("Fluglinie", "Fluglinienverwaltung"));
        DefaultMutableTreeNode aircraftT = new DefaultMutableTreeNode(
                new ToolTip ("Flugzeug", "Flugzeugverwaltung"));
        DefaultMutableTreeNode flightT = new DefaultMutableTreeNode(
                new ToolTip ("Flug", "Flugverwaltung"));
        DefaultMutableTreeNode flightRealizationT = new DefaultMutableTreeNode(
                new ToolTip ("Flugdurchführung", "Flugdurchführungsverwaltung"));
        DefaultMutableTreeNode bookingT = new DefaultMutableTreeNode(
                new ToolTip ("Buchung", "Buchungsverwaltung"));

        // Blätter für Passagier-Übersicht
        DefaultMutableTreeNode passengerAE = new DefaultMutableTreeNode(
                new ToolTip ("A-E", "Nachnamenbereich A-E"));
        DefaultMutableTreeNode passengerFJ = new DefaultMutableTreeNode(
                new ToolTip ("F-J", "Nachnamenbereich F-J"));
        DefaultMutableTreeNode passengerKO = new DefaultMutableTreeNode(
                new ToolTip ("K-O", "Nachnamenbereich K-O"));
        DefaultMutableTreeNode passengerPT = new DefaultMutableTreeNode(
                new ToolTip ("P-T", "Nachnamenbereich P-T"));
        DefaultMutableTreeNode passengerUZ = new DefaultMutableTreeNode(
                new ToolTip ("U-Z", "Nachnamenbereich U-Z"));

        // Blätter für Flug
         DefaultMutableTreeNode montag = new DefaultMutableTreeNode(
                new ToolTip ("Montag", "Tag des Fluges: Montag"));
        DefaultMutableTreeNode dienstag = new DefaultMutableTreeNode(
                new ToolTip ("Dienstag", "Tag des Fluges: Dienstag"));
        DefaultMutableTreeNode mittwoch = new DefaultMutableTreeNode(
                new ToolTip ("Mittwoch", "Tag des Fluges: Mittwoch"));
        DefaultMutableTreeNode donnerstag = new DefaultMutableTreeNode(
                new ToolTip ("Donnerstag", "Tag des Fluges: Donnerstag"));
        DefaultMutableTreeNode freitag = new DefaultMutableTreeNode(
                new ToolTip ("Freitag", "Tag des Fluges: Freitag"));
        DefaultMutableTreeNode samstag = new DefaultMutableTreeNode(
                new ToolTip ("Samstag", "Tag des Fluges: Samstag"));
        DefaultMutableTreeNode sonntag = new DefaultMutableTreeNode(
                new ToolTip ("Sonntag", "Tag des Fluges: Sonntag"));

        // Blätter für Flugdurchführung
         DefaultMutableTreeNode montagR = new DefaultMutableTreeNode(
                new ToolTip ("Montag", "Tag des Fluges: Montag"));
        DefaultMutableTreeNode dienstagR = new DefaultMutableTreeNode(
                new ToolTip ("Dienstag", "Tag des Fluges: Dienstag"));
        DefaultMutableTreeNode mittwochR = new DefaultMutableTreeNode(
                new ToolTip ("Mittwoch", "Tag des Fluges: Mittwoch"));
        DefaultMutableTreeNode donnerstagR = new DefaultMutableTreeNode(
                new ToolTip ("Donnerstag", "Tag des Fluges: Donnerstag"));
        DefaultMutableTreeNode freitagR = new DefaultMutableTreeNode(
                new ToolTip ("Freitag", "Tag des Fluges: Freitag"));
        DefaultMutableTreeNode samstagR = new DefaultMutableTreeNode(
                new ToolTip ("Samstag", "Tag des Fluges: Samstag"));
        DefaultMutableTreeNode sonntagR = new DefaultMutableTreeNode(
                new ToolTip ("Sonntag", "Tag des Fluges: Sonntag"));

        // ... dann werden sie verknüpft
        passengerT.add(passengerAE);
        passengerT.add(passengerFJ);
        passengerT.add(passengerKO);
        passengerT.add(passengerPT);
        passengerT.add(passengerUZ);

        flightT.add(montag);
        flightT.add(dienstag);
        flightT.add(mittwoch);
        flightT.add(donnerstag);
        flightT.add(freitag);
        flightT.add(samstag);
        flightT.add(sonntag);
        flightRealizationT.add(montagR);
        flightRealizationT.add(dienstagR);
        flightRealizationT.add(mittwochR);
        flightRealizationT.add(donnerstagR);
        flightRealizationT.add(freitagR);
        flightRealizationT.add(samstagR);
        flightRealizationT.add(sonntagR);

        verwaltung.add(passengerT);
        verwaltung.add(airportT);
        verwaltung.add(seatStructureT);
        verwaltung.add(aircraftTypT);
        verwaltung.add(airlineT);
        verwaltung.add(aircraftT);
        verwaltung.add(flightT);
        verwaltung.add(flightRealizationT);
        verwaltung.add(bookingT);


        final JTree tree = new JTree(verwaltung);
        tree.setCellRenderer( new Renderer() );

        ToolTipManager.sharedInstance().registerComponent( tree );

        final JScrollPane scrollTree = new JScrollPane(tree);

        DefaultMutableTreeNode currentNode = verwaltung.getNextNode();
        do {
            if (currentNode.getLevel()==1) tree.expandPath(new TreePath(currentNode.getPath()));
            currentNode = currentNode.getNextNode();
            }
        while (currentNode != null);
        tree.validate();
        tree.repaint();


        // Erstellung des Report-Trees
        final DefaultMutableTreeNode rootReport = new DefaultMutableTreeNode(
                new ToolTip ("Report > Verwaltung", "Reportverwaltung"));
        
        DefaultMutableTreeNode sitzBelegung = new DefaultMutableTreeNode(
                new ToolTip ("Sitzbelegungen", "Berichterstellung der Sitzbelegungen"));
        DefaultMutableTreeNode fluggastInfo = new DefaultMutableTreeNode(
                new ToolTip ("Fluggastinformationen", "Berichterstellung der Fluggastinformationen"));

        rootReport.add(fluggastInfo);
        rootReport.add(sitzBelegung);

        final JTree tree2 = new JTree(rootReport);
        tree2.setCellRenderer( new Renderer() );
        ToolTipManager.sharedInstance().registerComponent( tree2 );
        final JScrollPane scrollTree2 = new JScrollPane(tree2);

        leftp.add(scrollTree2);
        leftp.add(scrollTree);

        rightp = new JPanel(new CardLayout());

        // Start Begr Text
            StyleContext.NamedStyle centerStyle = StyleContext.getDefaultStyleContext().new NamedStyle();
            StyleConstants.setAlignment(centerStyle,StyleConstants.ALIGN_CENTER);
            StyleConstants.setFontSize(centerStyle, 20);
            StyleConstants.setForeground(centerStyle, Color.WHITE);

            JTextPane text = new JTextPane();
            text.setLogicalStyle(centerStyle);

            text.setText("\n\nHerzlich Willkommen auf unserem Flugbuchungsmanagementsystem\n\n"


            + "Über die linke Seite des Programms können Sie zwischen\n"
            + "den verschiedenen Objekten navigieren und diese verwalten\n"
            + "Dabei können folgende Objekte verwaltet werden:\n\n"
            + "- Passagier\n"
            + "- Flughafen\n"
            + "- Sitzstruktur\n"
            + "- Flugzeugtyp\n"
            + "- Fluglinie\n"
            + "- Flugzeug\n"
            + "- Flug\n"
            + "- Flugdurchführung\n"
            + "- Buchung\n\n"
            + "Dieses Projekt wurde erstellt von:\n"
            + "Philipp Armbruster, Stefan Fellner, Florian Härer,\n"
            + "Fabian Hoh, David Ponce, Philipp Reiser\n"
            );

    text.setEditable(false);
    text.setBackground(Color.GRAY);
    // Ende Begr Text


    ae = new AirportEdit(this);
    am = new AirportManage(this, ae);
    ac = new AirportCreate(this);
    ace = new AircraftEdit(this);
    acm = new AircraftManage(this, ace);
    acc = new AircraftCreate(this);
    acte = new AircraftTypEdit(this);
    actm = new AircraftTypeManage(this, acte);
    actc = new AircraftTypCreate(this);
    ale = new AirlineEdit(this);
    alm = new AirlineManage(this, ale);
    alc = new AirlineCreate(this);
    flm = new FlightManage(this);
    flc = new FlightCreate(this);
    flmMo = new FlightManageMo(this);
    flmDi = new FlightManageDi(this);
    flmMi = new FlightManageMi(this);
    flmDo = new FlightManageDo(this);
    flmFr = new FlightManageFr(this);
    flmSa = new FlightManageSa(this);
    flmSo = new FlightManageSo(this);
    flre = new FlightRealizationEdit (this);
    flrm = new FlightRealizationManage(this, flre);
    flrmMo = new FlightRealizationManageMo(this, flre);
    flrmDi = new FlightRealizationManageDi(this, flre);
    flrmMi = new FlightRealizationManageMi(this, flre);
    flrmDo = new FlightRealizationManageDo(this, flre);
    flrmFr = new FlightRealizationManageFr(this, flre);
    flrmSa = new FlightRealizationManageSa(this, flre);
    flrmSo = new FlightRealizationManageSo(this, flre);
    flrc = new FlightRealizationCreate(this);
    ovf = new OverviewFlights (this, flrc);
    ovfMo = new OverviewFlightsMo (this, flrc);
    ovfDi = new OverviewFlightsDi (this, flrc);
    ovfMi = new OverviewFlightsMi (this, flrc);
    ovfDo = new OverviewFlightsDo (this, flrc);
    ovfFr = new OverviewFlightsFr (this, flrc);
    ovfSa = new OverviewFlightsSa (this, flrc);
    ovfSo = new OverviewFlightsSo (this, flrc);
    pe = new PassengerEdit(this);
    pm = new PassengerManage(this, pe);
    pmAE = new PassengerManageAE(this, pe);
    pmFJ = new PassengerManageFJ(this, pe);
    pmKO = new PassengerManageKO(this, pe);
    pmPT = new PassengerManagePT(this, pe);
    pmUZ = new PassengerManageUZ(this, pe);
    pc = new PassengerCreate(this);
    stm = new SeatStructureManage(this);
    stc = new SeatStructureCreate(this);
    bm = new BookingManage(this);
    bc = new BookingCreate(this);
    rpi = new ReportShowPassengerinformation(this);
    rsp = new ReportShowSeatingPlan(this);

        rightp.add(text, "Text");
//        rightp.add(new MainPage(this), "One");
        rightp.add(pm.getJp(), "PassengerM");
        rightp.add(pmAE.getJp(), "PassengerAEM");
        rightp.add(pmFJ.getJp(), "PassengerFJM");
        rightp.add(pmKO.getJp(), "PassengerKOM");
        rightp.add(pmPT.getJp(), "PassengerPTM");
        rightp.add(pmUZ.getJp(), "PassengerUZM");
        rightp.add(pc.getJp(), "PassengerC");
        rightp.add(pe.getJp(), "PassengerE");
        rightp.add(am.getJp(), "AirportM");
        rightp.add(ac.getJp(), "AirportC");
        rightp.add(ae.getJp(), "AirportE");
        rightp.add(stm.getJp(), "SeatStructureM");
        rightp.add(stc.getJp(), "SeatStructureC");
        rightp.add(actm.getJp(), "AircraftTypeM");
        rightp.add(actc.getJp(), "AircraftTypeC");
        rightp.add(acte.getJp(), "AircraftTypeE");
        rightp.add(alm.getJp(), "AirlineM");
        rightp.add(alc.getJp(), "AirlineC");
        rightp.add(ale.getJp(), "AirlineE");
        rightp.add(acm.getJp(), "AircraftM");
        rightp.add(acc.getJp(), "AircraftC");
        rightp.add(ace.getJp(), "AircraftE");
        rightp.add(flm.getJp(), "FlightM");
        rightp.add(flmMo.getJp(), "FlightMoM");
        rightp.add(flmDi.getJp(), "FlightDiM");
        rightp.add(flmMi.getJp(), "FlightMiM");
        rightp.add(flmDo.getJp(), "FlightDoM");
        rightp.add(flmFr.getJp(), "FlightFrM");
        rightp.add(flmSa.getJp(), "FlightSaM");
        rightp.add(flmSo.getJp(), "FlightSoM");
        rightp.add(flc.getJp(), "FlightC");
        rightp.add(flrm.getJp(), "FlightRealizationM");
        rightp.add(flrmMo.getJp(), "FlightRealizationMoM");
        rightp.add(flrmDi.getJp(), "FlightRealizationDiM");
        rightp.add(flrmMi.getJp(), "FlightRealizationMiM");
        rightp.add(flrmDo.getJp(), "FlightRealizationDoM");
        rightp.add(flrmFr.getJp(), "FlightRealizationFrM");
        rightp.add(flrmSa.getJp(), "FlightRealizationSaM");
        rightp.add(flrmSo.getJp(), "FlightRealizationSoM");
        rightp.add(ovf.getJp(), "OverviewFlights");
        rightp.add(ovfMo.getJp(), "OverviewFlightsMo");
        rightp.add(ovfDi.getJp(), "OverviewFlightsDi");
        rightp.add(ovfMi.getJp(), "OverviewFlightsMi");
        rightp.add(ovfDo.getJp(), "OverviewFlightsDo");
        rightp.add(ovfFr.getJp(), "OverviewFlightsFr");
        rightp.add(ovfSa.getJp(), "OverviewFlightsSa");
        rightp.add(ovfSo.getJp(), "OverviewFlightsSo");
        rightp.add(flrc.getJp(), "FlightRealizationC");
        rightp.add(flre.getJp(), "FlightRealizationE");
        rightp.add(bm.getJp(), "BookingM");
        rightp.add(bc.getJp(), "BookingC");

        rightp.add(rsp, "SeatPlanR");
        rightp.add(rpi, "PassengerPlanR");

        rightp.add(new InfoText(this).getPassengerText(), "InfoTextPassenger");
        rightp.add(new InfoText(this).getAirportText(), "InfoTextAirport");
        rightp.add(new InfoText(this).getSeatStructureText(), "InfoTextSeat");
        rightp.add(new InfoText(this).getAircraftTypeText(), "InfoTextAircraftType");
        rightp.add(new InfoText(this).getAirlineText(), "InfoTextAirline");
        rightp.add(new InfoText(this).getAircraftText(), "InfoTextAircraft");
        rightp.add(new InfoText(this).getFlightText(), "InfoTextFlight");
        rightp.add(new InfoText(this).getFlightRealizationText(), "InfoTextFlightR");
        rightp.add(new InfoText(this).getBookingText(), "InfoTextBooking");
        rightp.add(new InfoText(this).getIntroText(), "IntroTextVerwaltung");


        rightp.add(new InfoText(this).getReportText(), "InfoTextReport");
        rightp.add(new InfoText(this).getEditorText(), "InfoTextEditor");


        // Add the scroll panes to a split pane.
        final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
        splitPane.setLeftComponent(scrollTree);
        splitPane.setRightComponent(rightp);

        splitPane.setContinuousLayout(false);
        splitPane.setDividerLocation(200);
        splitPane.setEnabled(false);

        // Add the split pane to this panel.
        getContentPane().add(splitPane);

        MouseListener ml = new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
                int selRow = tree.getRowForLocation(e.getX(), e.getY());
//                TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
                if(selRow != -1) {

                        DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree
                                .getLastSelectedPathComponent();

                        if (node == null) {
                            return;

                        } else if (node.toString().equals("Editor > Verwaltung")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "InfoTextEditor");
                            setTitle("Flugbuchungsmanagementsystem");
                        } else if (node.toString().equals("Passagier")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "PassengerM");
                            setTitle("Passagierverwaltung");
                        } else if (node.toString().equals("Flughafen")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "AirportM");
                            setTitle("Flughafenverwaltung");
                        } else if (node.toString().equals("A-E")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "PassengerAEM");
                            setTitle("Passagierverwaltung");
                        } else if (node.toString().equals("F-J")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "PassengerFJM");
                            setTitle("Passagierverwaltung");
                        } else if (node.toString().equals("K-O")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "PassengerKOM");
                            setTitle("Passagierverwaltung");
                        } else if (node.toString().equals("P-T")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "PassengerPTM");
                            setTitle("Passagierverwaltung");
                        } else if (node.toString().equals("U-Z")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "PassengerUZM");
                            setTitle("Passagierverwaltung");
                        } else if (node.toString().equals("Sitzstruktur")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "SeatStructureM");
                            setTitle("Sitzstrukturverwaltung");
                        } else if (node.toString().equals("Flugzeugtyp")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "AircraftTypeM");
                            setTitle("Flugzeugtypverwaltung");
                        } else if (node.toString().equals("Fluglinie")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "AirlineM");
                            setTitle("Fluglinienverwaltung");
                        } else if (node.toString().equals("Flugzeug")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "AircraftM");
                            setTitle("Flugzeugverwaltung");
                        } else if (node.toString().equals("Flug")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightM");
                            setTitle("Flugverwaltung");
                        } else if (node.toString().equals("Montag")
                                && node.getParent().toString().equals("Flug"))  {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightMoM");
                            setTitle("Flugverwaltung");
                        } else if (node.toString().equals("Dienstag")
                                && node.getParent().toString().equals("Flug")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightDiM");
                            setTitle("Flugverwaltung");
                        } else if (node.toString().equals("Mittwoch")
                                && node.getParent().toString().equals("Flug")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightMiM");
                            setTitle("Flugverwaltung");
                        } else if (node.toString().equals("Donnerstag")
                                && node.getParent().toString().equals("Flug")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightDoM");
                            setTitle("Flugverwaltung");
                        } else if (node.toString().equals("Freitag")
                                && node.getParent().toString().equals("Flug")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightFrM");
                            setTitle("Flugverwaltung");
                        } else if (node.toString().equals("Samstag")
                                && node.getParent().toString().equals("Flug")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightSaM");
                            setTitle("Flugverwaltung");
                        } else if (node.toString().equals("Sonntag")
                                && node.getParent().toString().equals("Flug")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightSoM");
                            setTitle("Flugverwaltung");
                        } else if (node.toString().equals("Flugdurchführung")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightRealizationM");
                            setTitle("Flugdurchführungsverwaltung");
                        } else if (node.toString().equals("Montag")
                                && node.getParent().toString().equals("Flugdurchführung"))  {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightRealizationMoM");
                            setTitle("Flugdurchführungsverwaltung");
                        } else if (node.toString().equals("Dienstag")
                                && node.getParent().toString().equals("Flugdurchführung")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightRealizationDiM");
                            setTitle("Flugdurchführungsverwaltung");
                        } else if (node.toString().equals("Mittwoch")
                                && node.getParent().toString().equals("Flugdurchführung")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightRealizationMiM");
                            setTitle("Flugdurchführungsverwaltung");
                        } else if (node.toString().equals("Donnerstag")
                                && node.getParent().toString().equals("Flugdurchführung")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightRealizationDoM");
                            setTitle("Flugdurchführungsverwaltung");
                        } else if (node.toString().equals("Freitag")
                                && node.getParent().toString().equals("Flugdurchführung")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightRealizationFrM");
                            setTitle("Flugdurchführungsverwaltung");
                        } else if (node.toString().equals("Samstag")
                                && node.getParent().toString().equals("Flugdurchführung")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightRealizationSaM");
                            setTitle("Flugdurchführungsverwaltung");
                        } else if (node.toString().equals("Sonntag")
                                && node.getParent().toString().equals("Flugdurchführung")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "FlightRealizationSoM");
                            setTitle("Flugdurchführungsverwaltung");
                        } else if (node.toString().equals("Buchung")) {
                            ((CardLayout) rightp.getLayout()).show(rightp,
                                    "BookingM");
                            setTitle("Buchungsverwaltung");
                    }
                }
            }
        };
        tree.addMouseListener(ml);

        tree2.getSelectionModel().addTreeSelectionListener(
                new TreeSelectionListener() {
                    @Override
                    public void valueChanged(TreeSelectionEvent e) {

                        DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree2
                                .getLastSelectedPathComponent();

                        if (node == null) {
                            return;

                        } else if (node.toString().equals("Report > Verwaltung")) {
                            ((CardLayout) rightp.getLayout()).show(rightp, "InfoTextReport");
                            setTitle("Flugbuchungsmanagementsystem");

                        } else if (node.toString().equals("Sitzbelegungen")) {
                            ((CardLayout) rightp.getLayout()).show(rightp, "SeatPlanR");
                            setTitle("Sitzbelegung von Flügen");

                        } else if (node.toString().equals("Fluggastinformationen")) {
                            ((CardLayout) rightp.getLayout()).show(rightp, "PassengerPlanR");
                            setTitle("Fluggastinformationen");
                        }
                    }
                });

        //Anfang JMenuBar

        // Menüleiste erzeugen
        menueLeiste = new JMenuBar();

        // Menüelemente erzeugen
        datei = new JMenu("Datei");

        //Menüelemente hinzufügen
        menueLeiste.add(datei);

        // Untermenüelemente erzeugen
        editor = new JMenuItem("Editor");
        report = new JMenuItem("Report");
        beenden = new JMenuItem("Beenden");

        datei.add(editor);
        datei.add(report);
        datei.add(new JSeparator());
        datei.add(beenden);


    beenden.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e){

                System.exit(0);
            }
        });
    editor.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e){

                leftp.add(scrollTree);
                splitPane.setLeftComponent(scrollTree);
                splitPane.setDividerLocation(200);
                ((CardLayout) rightp.getLayout()).show(rightp, "InfoTextEditor");


            }
        });
    report.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e){


                leftp.add(scrollTree2);
                splitPane.setLeftComponent(scrollTree2);
                splitPane.setDividerLocation(200);
                ((CardLayout) rightp.getLayout()).show(rightp, "InfoTextReport");

            }
        });
                        
    this.setJMenuBar(menueLeiste);
    }

    public void re() {

        rightp.revalidate();
        rightp.repaint();
        System.out.println("TD MEthode ausgef");



    }

    public void updatePassenger() throws RemoteException {

        // Vector mit Daten für JTable der Passenger belegen
        pm.rowData = admin.getAllPassengersForTable();
        pmAE.rowData = admin.getAllPassengersFromAtoEForTable();
        pmFJ.rowData = admin.getAllPassengersFromFtoJForTable();
        pmKO.rowData = admin.getAllPassengersFromKtoOForTable();
        pmPT.rowData = admin.getAllPassengersFromPtoTForTable();
        pmUZ.rowData = admin.getAllPassengersFromUtoZForTable();

        // Vector mit Daten für JTable der Bookings belegen
        bm.rowData = admin.getAllBookingsForTable();
        bc.rowData2 = admin.getAllPassengersForTable();

        // Vector mit Daten für JTable der Reports belegen
        rpi.rowData = admin.getAllPassengersForTable();

        // Tabelleninhalte werden aktualisiert (Passenger)
        pm.model.setDataVector(pm.rowData, pm.columnNames);
        pmAE.model.setDataVector(pmAE.rowData, pmAE.columnNames);
        pmFJ.model.setDataVector(pmFJ.rowData, pmFJ.columnNames);
        pmKO.model.setDataVector(pmKO.rowData, pmKO.columnNames);
        pmPT.model.setDataVector(pmPT.rowData, pmPT.columnNames);
        pmUZ.model.setDataVector(pmUZ.rowData, pmUZ.rowData);

        // Tabelleninhalte werden aktualisiert (Booking)
        bm.model.setDataVector(bm.rowData, bm.columnNames);
        bc.model2.setDataVector(bc.rowData2, bc.columnNames2);

        // Tabelleninhalte werden aktualisiert (Report)
        rpi.model.setDataVector(rpi.rowData, rpi.columnNames);

    }

    public void updateAirport() throws RemoteException {

        // Vector mit Daten für JTable der Airports belegen
        am.rowData = admin.getAllAirportsForTable();

        // Vector mit Daten für JTable der Flights belegen
        flm.rowData = admin.getAllFlightsForTable();
        flmMo.rowData = admin.getAllFlightsOnMondayForTable();
        flmDi.rowData = admin.getAllFlightsOnTuesdayForTable();
        flmMi.rowData = admin.getAllFlightsOnWednesdayForTable();
        flmDo.rowData = admin.getAllFlightsOnThursdayForTable();
        flmFr.rowData = admin.getAllFlightsOnFridayForTable();
        flmSa.rowData = admin.getAllFlightsOnSaturdayForTable();
        flmSo.rowData = admin.getAllFlightsOnSundayForTable();

        // Vector mit Daten für JTable der FlightRealizations belegen
        flrm.rowData = admin.getAllFlightRealizationsForTable();
        flrmMo.rowData = admin.getAllFlightRealizationsOnMondayForTable();
        flrmDi.rowData = admin.getAllFlightRealizationsOnTuesdayForTable();
        flrmMi.rowData = admin.getAllFlightRealizationsOnWednesdayForTable();
        flrmDo.rowData = admin.getAllFlightRealizationsOnThursdayForTable();
        flrmFr.rowData = admin.getAllFlightRealizationsOnFridayForTable();
        flrmSa.rowData = admin.getAllFlightRealizationsOnSaturdayForTable();
        flrmSo.rowData = admin.getAllFlightRealizationsOnSundayForTable();
        
        // Vector mit Daten für JTable der Flight Overviews belegen
        ovf.rowData = admin.getAllFlightsForTable();
        ovfMo.rowData = admin.getAllFlightsOnMondayForTable();
        ovfDi.rowData = admin.getAllFlightsOnTuesdayForTable();
        ovfMi.rowData = admin.getAllFlightsOnWednesdayForTable();
        ovfDo.rowData = admin.getAllFlightsOnThursdayForTable();
        ovfFr.rowData = admin.getAllFlightsOnFridayForTable();
        ovfSa.rowData = admin.getAllFlightsOnSaturdayForTable();
        ovfSo.rowData = admin.getAllFlightsOnSundayForTable();

        // Vector mit Daten für JTable der Bookings belegen
        bc.rowData1 = admin.getAllFlightRealizationsForTable();

        // ComboBox in BookingManage aktualisieren
        bm.allFlightRInformations = admin.getAllFlightRealizationInfosForComboBox();

        bm.model1 = new DefaultComboBoxModel(bm.allFlightRInformations);
        bm.comboBox1.setModel(bm.model1);

        // Vector mit Daten für JTable der Reports belegen
        rsp.rowData = admin.getAllFlightRealizationsForTable();

        // Tabelleninhalte werden aktualisiert (Airports)
        am.model.setDataVector(am.rowData, am.columnNames);

        // Tabelleninhalte werden aktualisiert (Flight)
        flm.model.setDataVector(flm.rowData, flm.columnNames);
        flmMo.model.setDataVector(flmMo.rowData, flmMo.rowData);
        flmDi.model.setDataVector(flmDi.rowData, flmDi.rowData);
        flmMi.model.setDataVector(flmMi.rowData, flmMi.columnNames);
        flmDo.model.setDataVector(flmDo.rowData, flmDo.columnNames);
        flmFr.model.setDataVector(flmFr.rowData, flmFr.columnNames);
        flmSa.model.setDataVector(flmSa.rowData, flmSa.columnNames);
        flmSo.model.setDataVector(flmSo.rowData, flmSo.columnNames);

        // Tabelleninhalte werden aktualisiert (FlightRealizations)
        flrm.model.setDataVector(flrm.rowData, flrm.columnNames);
        flrmMo.model.setDataVector(flrmMo.rowData, flrmMo.columnNames);
        flrmDi.model.setDataVector(flrmDi.rowData, flrmDi.columnNames);
        flrmMi.model.setDataVector(flrmMi.rowData, flrmMi.columnNames);
        flrmDo.model.setDataVector(flrmDo.rowData, flrmDo.columnNames);
        flrmFr.model.setDataVector(flrmFr.rowData, flrmFr.rowData);
        flrmSa.model.setDataVector(flrmSa.rowData, flrmSa.rowData);
        flrmSo.model.setDataVector(flrmSo.rowData, flrmSo.columnNames);

        // Tabelleninhalte werden aktualisiert (FlightOverview)
        ovf.model.setDataVector(ovf.rowData, ovf.columnNames);
        ovfMo.model.setDataVector(ovfMo.rowData, ovfMo.columnNames);
        ovfDi.model.setDataVector(ovfDi.rowData, ovfDi.columnNames);
        ovfMi.model.setDataVector(ovfMi.rowData, ovfMi.columnNames);
        ovfDo.model.setDataVector(ovfDo.rowData, ovfDo.columnNames);
        ovfFr.model.setDataVector(ovfFr.rowData, ovfFr.columnNames);
        ovfSa.model.setDataVector(ovfSa.rowData, ovfSa.columnNames);
        ovfSo.model.setDataVector(ovfSo.rowData, ovfSo.columnNames);

        // Tabelleninhalte werden aktualisiert (Booking)
        bc.model1.setDataVector(bc.rowData1, bc.columnNames1);

        // Tabelleninhalte werden aktualisiert (Report)
        rsp.model.setDataVector(rsp.rowData, rsp.columnNames);

        // ComboBoxen in FlightCreate aktualisieren
            // ComboBoxen der Flughäfen
            flc.allAirports = admin.getAllAirportsForComboBox();
            flc.allAirportCitiesAndIds = admin.getAllAirportCitiesAndIdsForComboBox();

            flc.model1 = new DefaultComboBoxModel(flc.allAirportCitiesAndIds);
            flc.model2 = new DefaultComboBoxModel(flc.allAirportCitiesAndIds);
            flc.comboBox3.setModel(flc.model1);
            flc.comboBox4.setModel(flc.model2);

        // Vector in AirportCreate aktualisieren
        ac.allAirports = admin.getAllAirportsForComboBox();
    }

    public void updateSeatStructure () throws RemoteException {

        // Vector mit Daten für JTable der SeatStructure belegen
        stm.rowData = admin.getAllSeatsForTable();

        // Tabelleninhalte werden aktualisiert (Booking)
        bm.model.setDataVector(bm.rowData, bm.columnNames);

        // Vector mit Daten für JTable der AircraftTypes belegen
        actm.rowData = admin.getAllTypeOfAircraftsForTable();

        // Tabelleninhalte werden aktualisiert (SeatStructure)
        stm.model.setDataVector(stm.rowData, stm.columnNames);

        // Tabelleninhalte werden aktualisiert (Booking)
        bm.model.setDataVector(bm.rowData, bm.columnNames);

        // Tabelleninhalte werden aktualisiert (AircraftType)
        actm.model.setDataVector(actm.rowData, actm.columnNames);

        // ComboBox in AircraftTypeCreate aktualisieren
        actc.allSeatInformation = admin.getAllSeatInformationForComboBox();

        actc.model1 = new DefaultComboBoxModel(actc.allSeatInformation);
        actc.comboBox1.setModel(actc.model1);

        // ComboBox in AircraftTypeEdit aktualisieren
        acte.allSeatInformation = admin.getAllSeatInformationForComboBox();

        // ComboBox in BookingManage aktualisieren
        bm.allFlightRInformations = admin.getAllFlightRealizationInfosForComboBox();

        bm.model1 = new DefaultComboBoxModel(bm.allFlightRInformations);
        bm.comboBox1.setModel(bm.model1);

    }

    public void updateAircraftType() throws RemoteException {

        // Vector mit Daten für JTable der AircraftTypes belegen
        actm.rowData = admin.getAllTypeOfAircraftsForTable();

        // Vector mit Daten für JTable der Aircrafts belegen
        acm.rowData = admin.getAllAircraftsForTable();

        // Tabelleninhalte werden aktualisiert (Aircraft)
        acm.model.setDataVector(acm.rowData, acm.columnNames);
        // Tabelleninhalte werden aktualisiert (AircraftType)
        actm.model.setDataVector(actm.rowData, actm.columnNames);

        // ComboBoxen in AircraftCreate aktualisieren
            // ComboBoxen des Flugzeugtypes
            acc.allTypeOfAircrafts = admin.getAllTypeOfAircraftsForComboBox();
            acc.allTypeOfAircraftNames = admin.getAllTypeOfAircraftInformationsForComboBox();

            acc.model1 = new DefaultComboBoxModel(acc.allTypeOfAircraftNames);
            acc.comboBox1.setModel(acc.model1);

        // ComboBoxen in AircraftEdit aktualisieren
            // ComboBoxen des Flugzeugtypes
            ace.allTypeOfAircrafts = admin.getAllTypeOfAircraftsForComboBox();
            ace.allTypeOfAircraftNames = admin.getAllTypeOfAircraftInformationsForComboBox();
    }

    public void updateAirline() throws RemoteException {

        // Vector mit Daten für JTable der Airlines belegen
        alm.rowData = admin.getAllAirlinesForTable();

        // Vector mit Daten für JTable der Aircrafts belegen
        acm.rowData = admin.getAllAircraftsForTable();

        // Vector mit Daten für JTable der Flights belegen
        flm.rowData = admin.getAllFlightsForTable();
        flmMo.rowData = admin.getAllFlightsOnMondayForTable();
        flmDi.rowData = admin.getAllFlightsOnTuesdayForTable();
        flmMi.rowData = admin.getAllFlightsOnWednesdayForTable();
        flmDo.rowData = admin.getAllFlightsOnThursdayForTable();
        flmFr.rowData = admin.getAllFlightsOnFridayForTable();
        flmSa.rowData = admin.getAllFlightsOnSaturdayForTable();
        flmSo.rowData = admin.getAllFlightsOnSundayForTable();

        // Vector mit Daten für JTable der FlightRealizations belegen
        flrm.rowData = admin.getAllFlightRealizationsForTable();
        flrmMo.rowData = admin.getAllFlightRealizationsOnMondayForTable();
        flrmDi.rowData = admin.getAllFlightRealizationsOnTuesdayForTable();
        flrmMi.rowData = admin.getAllFlightRealizationsOnWednesdayForTable();
        flrmDo.rowData = admin.getAllFlightRealizationsOnThursdayForTable();
        flrmFr.rowData = admin.getAllFlightRealizationsOnFridayForTable();
        flrmSa.rowData = admin.getAllFlightRealizationsOnSaturdayForTable();
        flrmSo.rowData = admin.getAllFlightRealizationsOnSundayForTable();

        // Vector mit Daten für JTable der Bookings belegen
        bc.rowData1 = admin.getAllFlightRealizationsForTable();

        // Vector mit Daten für JTable der Reports belegen
        rsp.rowData = admin.getAllFlightRealizationsForTable();

        // Tabelleninhalte werden aktualisiert (AircraftType)
        actm.model.setDataVector(actm.rowData, actm.columnNames);
        // Tabelleninhalte werden aktualisiert (Airline)
        alm.model.setDataVector(alm.rowData, alm.columnNames);

        // Tabelleninhalte werden aktualisiert (Flight)
        flm.model.setDataVector(flm.rowData, flm.columnNames);
        flmMo.model.setDataVector(flmMo.rowData, flmMo.rowData);
        flmDi.model.setDataVector(flmDi.rowData, flmDi.rowData);
        flmMi.model.setDataVector(flmMi.rowData, flmMi.columnNames);
        flmDo.model.setDataVector(flmDo.rowData, flmDo.columnNames);
        flmFr.model.setDataVector(flmFr.rowData, flmFr.columnNames);
        flmSa.model.setDataVector(flmSa.rowData, flmSa.columnNames);
        flmSo.model.setDataVector(flmSo.rowData, flmSo.columnNames);

        // Tabelleninhalte werden aktualisiert (FlightRealizations)
        flrm.model.setDataVector(flrm.rowData, flrm.columnNames);
        flrmMo.model.setDataVector(flrmMo.rowData, flrmMo.columnNames);
        flrmDi.model.setDataVector(flrmDi.rowData, flrmDi.columnNames);
        flrmMi.model.setDataVector(flrmMi.rowData, flrmMi.columnNames);
        flrmDo.model.setDataVector(flrmDo.rowData, flrmDo.columnNames);
        flrmFr.model.setDataVector(flrmFr.rowData, flrmFr.rowData);
        flrmSa.model.setDataVector(flrmSa.rowData, flrmSa.rowData);
        flrmSo.model.setDataVector(flrmSo.rowData, flrmSo.columnNames);

        // Tabelleninhalte werden aktualisiert (Booking)
        bc.model1.setDataVector(bc.rowData1, bc.columnNames1);
        // Tabelleninhalte werden aktualisiert (Report)
        rsp.model.setDataVector(rsp.rowData, rsp.columnNames);

        // ComboBox der Fluglinien
        acc.allAirlines = admin.getAllAirlinesForComboBox();
        acc.allAirlineNames = admin.getAllAirlineNamesForComboBox();

        acc.model2 = new DefaultComboBoxModel(acc.allAirlineNames);
        acc.comboBox2.setModel(acc.model2);

        // ComboBox der Fluglinien
        ace.allAirlines = admin.getAllAirlinesForComboBox();
        ace.allAirlineNames = admin.getAllAirlineNamesForComboBox();

        ace.model2 = new DefaultComboBoxModel(ace.allAirlineNames);
        ace.comboBox2.setModel(ace.model2);

        // ComboBox der Fluglinien
        flc.allAirlines = admin.getAllAirlinesForComboBox();
        flc.allAirlineNames = admin.getAllAirlineNamesForComboBox();

        flc.model3 = new DefaultComboBoxModel(flc.allAirlineNames);
        flc.comboBox5.setModel(flc.model3);

        // Vector der Fluglinien aktualisieren
        flre.allAirlines = admin.getAllAirlinesForComboBox();

        // ComboBox in BookingManage aktualisieren
        bm.allFlightRInformations = admin.getAllFlightRealizationInfosForComboBox();

        bm.model1 = new DefaultComboBoxModel(bm.allFlightRInformations);
        bm.comboBox1.setModel(bm.model1);

        // ComboBox des ShowPassangerInformation-Reports
        rpi.allAirlines = admin.getAllAirlinesForComboBox();
        rpi.allAirlineNames = admin.getAllAirlineNamesForComboBox();

        rpi.model1 = new DefaultComboBoxModel(rpi.allAirlineNames);
        rpi.comboBox1.setModel(rpi.model1);

    }

    public void updateAircraft() throws RemoteException {

        // Vector mit Daten für JTable der Aircrafts belegen
        acm.rowData = admin.getAllAircraftsForTable();

        // Tabelleninhalte werden aktualisiert (Aircraft)
        acm.model.setDataVector(acm.rowData, acm.columnNames);

        // ComboBoxen in FlightRealizationCreate aktualisieren
        flrc.allAirlines = admin.getAllAirlinesForComboBox();

        // Vector aller Flugzeuge in allen FlightRealizationManage-Klassen aktualisieren
        flrm.allAircrafts = admin.getAllAircraftsForComboBox();
        flrmMo.allAircrafts = admin.getAllAircraftsForComboBox();
        flrmDi.allAircrafts = admin.getAllAircraftsForComboBox();
        flrmMi.allAircrafts = admin.getAllAircraftsForComboBox();
        flrmDo.allAircrafts = admin.getAllAircraftsForComboBox();
        flrmFr.allAircrafts = admin.getAllAircraftsForComboBox();
        flrmSa.allAircrafts = admin.getAllAircraftsForComboBox();
        flrmSo.allAircrafts = admin.getAllAircraftsForComboBox();

        // Tabelleninhalte werden aktualisiert (FlightRealizations)
        flrm.model.setDataVector(flrm.rowData, flrm.columnNames);
        flrmMo.model.setDataVector(flrmMo.rowData, flrmMo.columnNames);
        flrmDi.model.setDataVector(flrmDi.rowData, flrmDi.columnNames);
        flrmMi.model.setDataVector(flrmMi.rowData, flrmMi.columnNames);
        flrmDo.model.setDataVector(flrmDo.rowData, flrmDo.columnNames);
        flrmFr.model.setDataVector(flrmFr.rowData, flrmFr.rowData);
        flrmSa.model.setDataVector(flrmSa.rowData, flrmSa.rowData);
        flrmSo.model.setDataVector(flrmSo.rowData, flrmSo.columnNames);

        // ComboBox in BookingManage aktualisieren
        bm.allFlightRInformations = admin.getAllFlightRealizationInfosForComboBox();

        bm.model1 = new DefaultComboBoxModel(bm.allFlightRInformations);
        bm.comboBox1.setModel(bm.model1);

        // Vector in AircraftCreate aktualisieren
        acc.allAircrafts = admin.getAllAircraftsForComboBox();
        ace.allAircrafts = admin.getAllAircraftsForComboBox();
    }

    public void updateFlight() throws RemoteException {

        // Vector mit Daten für JTable der Flights belegen
        flm.rowData = admin.getAllFlightsForTable();
        flmMo.rowData = admin.getAllFlightsOnMondayForTable();
        flmDi.rowData = admin.getAllFlightsOnTuesdayForTable();
        flmMi.rowData = admin.getAllFlightsOnWednesdayForTable();
        flmDo.rowData = admin.getAllFlightsOnThursdayForTable();
        flmFr.rowData = admin.getAllFlightsOnFridayForTable();
        flmSa.rowData = admin.getAllFlightsOnSaturdayForTable();
        flmSo.rowData = admin.getAllFlightsOnSundayForTable();

        // Vector mit Daten für JTable der Flight Overviews belegen
        ovf.rowData = admin.getAllFlightsForTable();
        ovfMo.rowData = admin.getAllFlightsOnMondayForTable();
        ovfDi.rowData = admin.getAllFlightsOnTuesdayForTable();
        ovfMi.rowData = admin.getAllFlightsOnWednesdayForTable();
        ovfDo.rowData = admin.getAllFlightsOnThursdayForTable();
        ovfFr.rowData = admin.getAllFlightsOnFridayForTable();
        ovfSa.rowData = admin.getAllFlightsOnSaturdayForTable();
        ovfSo.rowData = admin.getAllFlightsOnSundayForTable();

        // Tabelleninhalte werden aktualisiert (Flight)
        flm.model.setDataVector(flm.rowData, flm.columnNames);
        flmMo.model.setDataVector(flmMo.rowData, flmMo.rowData);
        flmDi.model.setDataVector(flmDi.rowData, flmDi.rowData);
        flmMi.model.setDataVector(flmMi.rowData, flmMi.columnNames);
        flmDo.model.setDataVector(flmDo.rowData, flmDo.columnNames);
        flmFr.model.setDataVector(flmFr.rowData, flmFr.columnNames);
        flmSa.model.setDataVector(flmSa.rowData, flmSa.columnNames);
        flmSo.model.setDataVector(flmSo.rowData, flmSo.columnNames);

        // Tabelleninhalte werden aktualisiert (FlightOverview)
        ovf.model.setDataVector(ovf.rowData, ovf.columnNames);
        ovfMo.model.setDataVector(ovfMo.rowData, ovfMo.columnNames);
        ovfDi.model.setDataVector(ovfDi.rowData, ovfDi.columnNames);
        ovfMi.model.setDataVector(ovfMi.rowData, ovfMi.columnNames);
        ovfDo.model.setDataVector(ovfDo.rowData, ovfDo.columnNames);
        ovfFr.model.setDataVector(ovfFr.rowData, ovfFr.columnNames);
        ovfSa.model.setDataVector(ovfSa.rowData, ovfSa.columnNames);
        ovfSo.model.setDataVector(ovfSo.rowData, ovfSo.columnNames);

        // ComboBox in BookingManage aktualisieren
        bm.allFlightRInformations = admin.getAllFlightRealizationInfosForComboBox();

        bm.model1 = new DefaultComboBoxModel(bm.allFlightRInformations);
        bm.comboBox1.setModel(bm.model1);
    }

    public void updateFlightRealization() throws RemoteException {

        // Vector mit Daten für JTable der FlightRealizations belegen
        flrm.rowData = admin.getAllFlightRealizationsForTable();
        flrmMo.rowData = admin.getAllFlightRealizationsOnMondayForTable();
        flrmDi.rowData = admin.getAllFlightRealizationsOnTuesdayForTable();
        flrmMi.rowData = admin.getAllFlightRealizationsOnWednesdayForTable();
        flrmDo.rowData = admin.getAllFlightRealizationsOnThursdayForTable();
        flrmFr.rowData = admin.getAllFlightRealizationsOnFridayForTable();
        flrmSa.rowData = admin.getAllFlightRealizationsOnSaturdayForTable();
        flrmSo.rowData = admin.getAllFlightRealizationsOnSundayForTable();

        // Vector aller Flugzeuge in allen FlightRealizationManage-Klassen aktualisieren
        flrm.allAircrafts = admin.getAllAircraftsForComboBox();
        flrmMo.allAircrafts = admin.getAllAircraftsForComboBox();
        flrmDi.allAircrafts = admin.getAllAircraftsForComboBox();
        flrmMi.allAircrafts = admin.getAllAircraftsForComboBox();
        flrmDo.allAircrafts = admin.getAllAircraftsForComboBox();
        flrmFr.allAircrafts = admin.getAllAircraftsForComboBox();
        flrmSa.allAircrafts = admin.getAllAircraftsForComboBox();
        flrmSo.allAircrafts = admin.getAllAircraftsForComboBox();

        // Vector mit Daten für JTable der Bookings belegen
        bc.rowData1 = admin.getAllFlightRealizationsForTable();

        // Vector mit Daten für JTable der Reports belegen
        rsp.rowData = admin.getAllFlightRealizationsForTable();

        // Tabelleninhalte werden aktualisiert (FlightRealizations)
        flrm.model.setDataVector(flrm.rowData, flrm.columnNames);
        flrmMo.model.setDataVector(flrmMo.rowData, flrmMo.columnNames);
        flrmDi.model.setDataVector(flrmDi.rowData, flrmDi.columnNames);
        flrmMi.model.setDataVector(flrmMi.rowData, flrmMi.columnNames);
        flrmDo.model.setDataVector(flrmDo.rowData, flrmDo.columnNames);
        flrmFr.model.setDataVector(flrmFr.rowData, flrmFr.rowData);
        flrmSa.model.setDataVector(flrmSa.rowData, flrmSa.rowData);
        flrmSo.model.setDataVector(flrmSo.rowData, flrmSo.columnNames); 

        // Tabelleninhalte werden aktualisiert (Booking)
        bc.model1.setDataVector(bc.rowData1, bc.columnNames1);

        // ComboBox in BookingManage aktualisieren
        bm.allFlightRInformations = admin.getAllFlightRealizationInfosForComboBox();

        bm.model1 = new DefaultComboBoxModel(bm.allFlightRInformations);
        bm.comboBox1.setModel(bm.model1);

        // Tabelleninhalte werden aktualisiert (Report)
        rsp.model.setDataVector(rsp.rowData, rsp.columnNames);

    }

    public void updateBooking() throws RemoteException {

        // Vector mit Daten für JTable der Bookings belegen
        bm.rowData = admin.getAllBookingsForTable();
        bc.rowData1 = admin.getAllFlightRealizationsForTable();
        bc.rowData2 = admin.getAllPassengersForTable();

        // Tabelleninhalte werden aktualisiert (Booking)
        bm.model.setDataVector(bm.rowData, bm.columnNames);
        bc.model1.setDataVector(bc.rowData1, bc.columnNames1);
        bc.model2.setDataVector(bc.rowData2, bc.columnNames2);

    }

//    public void updateAll() throws RemoteException {
//
//        // Vector mit Daten für JTable der Passenger belegen
//        pm.rowData = admin.getAllPassengersForTable();
//        pmAE.rowData = admin.getAllPassengersFromAtoEForTable();
//        pmFJ.rowData = admin.getAllPassengersFromFtoJForTable();
//        pmKO.rowData = admin.getAllPassengersFromKtoOForTable();
//        pmPT.rowData = admin.getAllPassengersFromPtoTForTable();
//        pmUZ.rowData = admin.getAllPassengersFromUtoZForTable();
//
//        // Vector mit Daten für JTable der Airports belegen
//        am.rowData = admin.getAllAirportsForTable();
//        // Vector mit Daten für JTable der Aircrafts belegen
//        acm.rowData = admin.getAllAircraftsForTable();
//        // Vector mit Daten für JTable der AircraftTypes belegen
//        actm.rowData = admin.getAllTypeOfAircraftsForTable();
//        // Vector mit Daten für JTable der Airlines belegen
//        alm.rowData = admin.getAllAirlinesForTable();
//
//        // Vector mit Daten für JTable der Flights belegen
//        flm.rowData = admin.getAllFlightsForTable();
//        flmMo.rowData = admin.getAllFlightsOnMondayForTable();
//        flmDi.rowData = admin.getAllFlightsOnTuesdayForTable();
//        flmMi.rowData = admin.getAllFlightsOnWednesdayForTable();
//        flmDo.rowData = admin.getAllFlightsOnThursdayForTable();
//        flmFr.rowData = admin.getAllFlightsOnFridayForTable();
//        flmSa.rowData = admin.getAllFlightsOnSaturdayForTable();
//        flmSo.rowData = admin.getAllFlightsOnSundayForTable();
//
//        // Vector mit Daten für JTable der FlightRealizations belegen
//        flrm.rowData = admin.getAllFlightRealizationsForTable();
//        flrmMo.rowData = admin.getAllFlightRealizationsOnMondayForTable();
//        flrmDi.rowData = admin.getAllFlightRealizationsOnTuesdayForTable();
//        flrmMi.rowData = admin.getAllFlightRealizationsOnWednesdayForTable();
//        flrmDo.rowData = admin.getAllFlightRealizationsOnThursdayForTable();
//        flrmFr.rowData = admin.getAllFlightRealizationsOnFridayForTable();
//        flrmSa.rowData = admin.getAllFlightRealizationsOnSaturdayForTable();
//        flrmSo.rowData = admin.getAllFlightRealizationsOnSundayForTable();
//
//        // Vector mit Daten für JTable der Flight Overviews belegen
//        ovf.rowData = admin.getAllFlightsForTable();
//        ovfMo.rowData = admin.getAllFlightsOnMondayForTable();
//        ovfDi.rowData = admin.getAllFlightsOnTuesdayForTable();
//        ovfMi.rowData = admin.getAllFlightsOnWednesdayForTable();
//        ovfDo.rowData = admin.getAllFlightsOnThursdayForTable();
//        ovfFr.rowData = admin.getAllFlightsOnFridayForTable();
//        ovfSa.rowData = admin.getAllFlightsOnSaturdayForTable();
//        ovfSo.rowData = admin.getAllFlightsOnSundayForTable();
//
//        // Vector mit Daten für JTable der SeatStructure belegen
//        stm.rowData = admin.getAllSeatsForTable();
//
//        // Vector mit Daten für JTable der Bookings belegen
//        bm.rowData = admin.getAllBookingsForTable();
//        bc.rowData1 = admin.getAllFlightRealizationsForTable();
//        bc.rowData2 = admin.getAllPassengersForTable();
//
//        // Vector mit Daten für JTable der Reports belegen
//        rpi.rowData = admin.getAllPassengersForTable();
//        rsp.rowData = admin.getAllFlightRealizationsForTable();
//
//
//        // Tabelleninhalte werden aktualisiert (Passenger)
//        pm.model.setDataVector(pm.rowData, pm.columnNames);
//        pmAE.model.setDataVector(pmAE.rowData, pmAE.columnNames);
//        pmFJ.model.setDataVector(pmFJ.rowData, pmFJ.columnNames);
//        pmKO.model.setDataVector(pmKO.rowData, pmKO.columnNames);
//        pmPT.model.setDataVector(pmPT.rowData, pmPT.columnNames);
//        pmUZ.model.setDataVector(pmUZ.rowData, pmUZ.rowData);
//
//        // Tabelleninhalte werden aktualisiert (Airports)
//        am.model.setDataVector(am.rowData, am.columnNames);
//        // Tabelleninhalte werden aktualisiert (Aircraft)
//        acm.model.setDataVector(acm.rowData, acm.columnNames);
//        // Tabelleninhalte werden aktualisiert (AircraftType)
//        actm.model.setDataVector(actm.rowData, actm.columnNames);
//        // Tabelleninhalte werden aktualisiert (Airline)
//        alm.model.setDataVector(alm.rowData, alm.columnNames);
//
//        // Tabelleninhalte werden aktualisiert (Flight)
//        flm.model.setDataVector(flm.rowData, flm.columnNames);
//        flmMo.model.setDataVector(flmMo.rowData, flmMo.rowData);
//        flmDi.model.setDataVector(flmDi.rowData, flmDi.rowData);
//        flmMi.model.setDataVector(flmMi.rowData, flmMi.columnNames);
//        flmDo.model.setDataVector(flmDo.rowData, flmDo.columnNames);
//        flmFr.model.setDataVector(flmFr.rowData, flmFr.columnNames);
//        flmSa.model.setDataVector(flmSa.rowData, flmSa.columnNames);
//        flmSo.model.setDataVector(flmSo.rowData, flmSo.columnNames);
//
//        // Tabelleninhalte werden aktualisiert (FlightRealizations)
//        flrm.model.setDataVector(flrm.rowData, flrm.columnNames);
//        flrmMo.model.setDataVector(flrmMo.rowData, flrmMo.columnNames);
//        flrmDi.model.setDataVector(flrmDi.rowData, flrmDi.columnNames);
//        flrmMi.model.setDataVector(flrmMi.rowData, flrmMi.columnNames);
//        flrmDo.model.setDataVector(flrmDo.rowData, flrmDo.columnNames);
//        flrmFr.model.setDataVector(flrmFr.rowData, flrmFr.rowData);
//        flrmSa.model.setDataVector(flrmSa.rowData, flrmSa.rowData);
//        flrmSo.model.setDataVector(flrmSo.rowData, flrmSo.columnNames);
//
//        // Tabelleninhalte werden aktualisiert (FlightOverview)
//        ovf.model.setDataVector(ovf.rowData, ovf.columnNames);
//        ovfMo.model.setDataVector(ovfMo.rowData, ovfMo.columnNames);
//        ovfDi.model.setDataVector(ovfDi.rowData, ovfDi.columnNames);
//        ovfMi.model.setDataVector(ovfMi.rowData, ovfMi.columnNames);
//        ovfDo.model.setDataVector(ovfDo.rowData, ovfDo.columnNames);
//        ovfFr.model.setDataVector(ovfFr.rowData, ovfFr.columnNames);
//        ovfSa.model.setDataVector(ovfSa.rowData, ovfSa.columnNames);
//        ovfSo.model.setDataVector(ovfSo.rowData, ovfSo.columnNames);
//
//        // Tabelleninhalte werden aktualisiert (Booking)
//        bm.model.setDataVector(bm.rowData, bm.columnNames);
//        bc.model1.setDataVector(bc.rowData1, bc.columnNames1);
//        bc.model2.setDataVector(bc.rowData2, bc.columnNames2);
//
//        // Tabelleninhalte werden aktualisiert (SeatStructure)
//        stm.model.setDataVector(stm.rowData, stm.columnNames);
//
//        // ComboBoxen in FlightCreate aktualisieren
//            // ComboBoxen der Flughäfen
//            flc.allAirports = admin.getAllAirportsForComboBox();
//            flc.allAirportCitiesAndIds = admin.getAllAirportCitiesAndIdsForComboBox();
//
//            flc.model1 = new DefaultComboBoxModel(flc.allAirportCitiesAndIds);
//            flc.model2 = new DefaultComboBoxModel(flc.allAirportCitiesAndIds);
//            flc.comboBox3.setModel(flc.model1);
//            flc.comboBox4.setModel(flc.model2);
//
//            // ComboBox der Fluglinien
//            flc.allAirlines = admin.getAllAirlinesForComboBox();
//            flc.allAirlineNames = admin.getAllAirlineNamesForComboBox();
//
//            flc.model3 = new DefaultComboBoxModel(flc.allAirlineNames);
//            flc.comboBox5.setModel(flc.model3);
//
//        // ComboBoxen in FlightEdit aktualisieren
//            // ComboBoxen der Flughäfen
//            fle.allAirports = admin.getAllAirportsForComboBox();
//            fle.allAirportCitiesAndIds = admin.getAllAirportCitiesAndIdsForComboBox();
//
//            fle.model1 = new DefaultComboBoxModel(fle.allAirportCitiesAndIds);
//            fle.model2 = new DefaultComboBoxModel(fle.allAirportCitiesAndIds);
//            fle.comboBox3.setModel(fle.model1);
//            fle.comboBox4.setModel(fle.model2);
//
//            // ComboBox der Fluglinien
//            fle.allAirlines = admin.getAllAirlinesForComboBox();
//            fle.allAirlineNames = admin.getAllAirlineNamesForComboBox();
//
//            fle.model3 = new DefaultComboBoxModel(fle.allAirlineNames);
//            fle.comboBox5.setModel(fle.model3);
//
//        // ComboBox in BookingManage aktualisieren
//            bm.allFlightRInformations = admin.getAllFlightRealizationInfosForComboBox();
//
//            bm.model1 = new DefaultComboBoxModel(bm.allFlightRInformations);
//            bm.comboBox1.setModel(bm.model1);
//
//        // ComboBox in AircraftTypeCreate aktualisieren
//            actc.allSeatInformation = admin.getAllSeatInformationForComboBox();
//
//            actc.model1 = new DefaultComboBoxModel(actc.allSeatInformation);
//            actc.comboBox1.setModel(actc.model1);
//
//        // ComboBox in AircraftTypeEdit aktualisieren
//            acte.allSeatInformation = admin.getAllSeatInformationForComboBox();
//
//            acte.model1 = new DefaultComboBoxModel(acte.allSeatInformation);
//            acte.comboBox1.setModel(acte.model1);
//
//        // ComboBoxen in AircraftCreate aktualisieren
//            // ComboBoxen des Flugzeugtypes
//            acc.allTypeOfAircrafts = admin.getAllTypeOfAircraftsForComboBox();
//            acc.allTypeOfAircraftNames = admin.getAllTypeOfAircraftInformationsForComboBox();
//
//            acc.model1 = new DefaultComboBoxModel(acc.allTypeOfAircraftNames);
//            acc.comboBox1.setModel(acc.model1);
//
//            // ComboBox der Fluglinien
//            acc.allAirlines = admin.getAllAirlinesForComboBox();
//            acc.allAirlineNames = admin.getAllAirlineNamesForComboBox();
//
//            acc.model2 = new DefaultComboBoxModel(acc.allAirlineNames);
//            acc.comboBox2.setModel(acc.model2);
//
//        // ComboBoxen in AircraftEdit aktualisieren
//            // ComboBoxen des Flugzeugtypes
//            ace.allTypeOfAircrafts = admin.getAllTypeOfAircraftsForComboBox();
//            ace.allTypeOfAircraftNames = admin.getAllTypeOfAircraftInformationsForComboBox();
//
//            ace.model1 = new DefaultComboBoxModel(ace.allTypeOfAircraftNames);
//            ace.comboBox1.setModel(ace.model1);
//
//            // ComboBox der Fluglinien
//            ace.allAirlines = admin.getAllAirlinesForComboBox();
//            ace.allAirlineNames = admin.getAllAirlineNamesForComboBox();
//
//            ace.model2 = new DefaultComboBoxModel(ace.allAirlineNames);
//            ace.comboBox2.setModel(ace.model2);
//
//        // ComboBoxen in FlightRealizationCreate aktualisieren
//            flrc.allAirlines = admin.getAllAirlinesForComboBox();
//
//        // Tabelleninhalte werden aktualisiert (Report)
//        rpi.rowData = admin.getAllPassengersForTable();
//        rpi.model.setDataVector(rpi.rowData, rpi.columnNames);
//
//        rsp.rowData = admin.getAllFlightRealizationsForTable();
//        rsp.model.setDataVector(rsp.rowData, rsp.columnNames);
//
//    }

/** Returns an ImageIcon, or null if the path was invalid. */
//private ImageIcon createImageIcon(String path, String description) {
//    java.net.URL imgURL = getClass().getResource(path);
//    if (imgURL != null) {
//        return new ImageIcon(imgURL, description);
//    } else {
//        System.err.println("Couldn't find file: " + path);
//        return null;
//    }
//}

    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
        try {
            Main td = new Main();
            td.setSize(1000, 700);
            td.setLocationRelativeTo(null);
            td.setVisible(true);
        } catch (RemoteException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
            }
        });
    }
}
